Left Termination of the query pattern minus_in_3(g, a, a) w.r.t. the given Prolog program could successfully be proven:



Prolog
  ↳ PrologToPiTRSProof

Clauses:

p(0, 0).
p(s(X), X).
le(0, Y, true).
le(s(X), 0, false).
le(s(X), s(Y), B) :- le(X, Y, B).
minus(X, Y, Z) :- ','(le(X, Y, B), if(B, X, Y, Z)).
if(true, X, Y, 0).
if(false, X, Y, s(Z)) :- ','(p(X, X1), minus(X1, Y, Z)).

Queries:

minus(g,a,a).

We use the technique of [30]. With regard to the inferred argument filtering the predicates were used in the following modes:
minus_in: (b,f,f)
le_in: (b,f,f)
if_in: (b,b,f,f)
Transforming Prolog into the following Term Rewriting System:
Pi-finite rewrite system:
The TRS R consists of the following rules:

minus_in_gaa(X, Y, Z) → U2_gaa(X, Y, Z, le_in_gaa(X, Y, B))
le_in_gaa(0, Y, true) → le_out_gaa(0, Y, true)
le_in_gaa(s(X), 0, false) → le_out_gaa(s(X), 0, false)
le_in_gaa(s(X), s(Y), B) → U1_gaa(X, Y, B, le_in_gaa(X, Y, B))
U1_gaa(X, Y, B, le_out_gaa(X, Y, B)) → le_out_gaa(s(X), s(Y), B)
U2_gaa(X, Y, Z, le_out_gaa(X, Y, B)) → U3_gaa(X, Y, Z, if_in_ggaa(B, X, Y, Z))
if_in_ggaa(true, X, Y, 0) → if_out_ggaa(true, X, Y, 0)
if_in_ggaa(false, X, Y, s(Z)) → U4_ggaa(X, Y, Z, p_in_ga(X, X1))
p_in_ga(0, 0) → p_out_ga(0, 0)
p_in_ga(s(X), X) → p_out_ga(s(X), X)
U4_ggaa(X, Y, Z, p_out_ga(X, X1)) → U5_ggaa(X, Y, Z, minus_in_gaa(X1, Y, Z))
U5_ggaa(X, Y, Z, minus_out_gaa(X1, Y, Z)) → if_out_ggaa(false, X, Y, s(Z))
U3_gaa(X, Y, Z, if_out_ggaa(B, X, Y, Z)) → minus_out_gaa(X, Y, Z)

The argument filtering Pi contains the following mapping:
minus_in_gaa(x1, x2, x3)  =  minus_in_gaa(x1)
U2_gaa(x1, x2, x3, x4)  =  U2_gaa(x1, x4)
le_in_gaa(x1, x2, x3)  =  le_in_gaa(x1)
0  =  0
le_out_gaa(x1, x2, x3)  =  le_out_gaa(x3)
s(x1)  =  s(x1)
U1_gaa(x1, x2, x3, x4)  =  U1_gaa(x4)
U3_gaa(x1, x2, x3, x4)  =  U3_gaa(x4)
if_in_ggaa(x1, x2, x3, x4)  =  if_in_ggaa(x1, x2)
true  =  true
if_out_ggaa(x1, x2, x3, x4)  =  if_out_ggaa(x4)
false  =  false
U4_ggaa(x1, x2, x3, x4)  =  U4_ggaa(x4)
p_in_ga(x1, x2)  =  p_in_ga(x1)
p_out_ga(x1, x2)  =  p_out_ga(x2)
U5_ggaa(x1, x2, x3, x4)  =  U5_ggaa(x4)
minus_out_gaa(x1, x2, x3)  =  minus_out_gaa(x3)

Infinitary Constructor Rewriting Termination of PiTRS implies Termination of Prolog



↳ Prolog
  ↳ PrologToPiTRSProof
PiTRS
      ↳ DependencyPairsProof

Pi-finite rewrite system:
The TRS R consists of the following rules:

minus_in_gaa(X, Y, Z) → U2_gaa(X, Y, Z, le_in_gaa(X, Y, B))
le_in_gaa(0, Y, true) → le_out_gaa(0, Y, true)
le_in_gaa(s(X), 0, false) → le_out_gaa(s(X), 0, false)
le_in_gaa(s(X), s(Y), B) → U1_gaa(X, Y, B, le_in_gaa(X, Y, B))
U1_gaa(X, Y, B, le_out_gaa(X, Y, B)) → le_out_gaa(s(X), s(Y), B)
U2_gaa(X, Y, Z, le_out_gaa(X, Y, B)) → U3_gaa(X, Y, Z, if_in_ggaa(B, X, Y, Z))
if_in_ggaa(true, X, Y, 0) → if_out_ggaa(true, X, Y, 0)
if_in_ggaa(false, X, Y, s(Z)) → U4_ggaa(X, Y, Z, p_in_ga(X, X1))
p_in_ga(0, 0) → p_out_ga(0, 0)
p_in_ga(s(X), X) → p_out_ga(s(X), X)
U4_ggaa(X, Y, Z, p_out_ga(X, X1)) → U5_ggaa(X, Y, Z, minus_in_gaa(X1, Y, Z))
U5_ggaa(X, Y, Z, minus_out_gaa(X1, Y, Z)) → if_out_ggaa(false, X, Y, s(Z))
U3_gaa(X, Y, Z, if_out_ggaa(B, X, Y, Z)) → minus_out_gaa(X, Y, Z)

The argument filtering Pi contains the following mapping:
minus_in_gaa(x1, x2, x3)  =  minus_in_gaa(x1)
U2_gaa(x1, x2, x3, x4)  =  U2_gaa(x1, x4)
le_in_gaa(x1, x2, x3)  =  le_in_gaa(x1)
0  =  0
le_out_gaa(x1, x2, x3)  =  le_out_gaa(x3)
s(x1)  =  s(x1)
U1_gaa(x1, x2, x3, x4)  =  U1_gaa(x4)
U3_gaa(x1, x2, x3, x4)  =  U3_gaa(x4)
if_in_ggaa(x1, x2, x3, x4)  =  if_in_ggaa(x1, x2)
true  =  true
if_out_ggaa(x1, x2, x3, x4)  =  if_out_ggaa(x4)
false  =  false
U4_ggaa(x1, x2, x3, x4)  =  U4_ggaa(x4)
p_in_ga(x1, x2)  =  p_in_ga(x1)
p_out_ga(x1, x2)  =  p_out_ga(x2)
U5_ggaa(x1, x2, x3, x4)  =  U5_ggaa(x4)
minus_out_gaa(x1, x2, x3)  =  minus_out_gaa(x3)


Using Dependency Pairs [1,30] we result in the following initial DP problem:
Pi DP problem:
The TRS P consists of the following rules:

MINUS_IN_GAA(X, Y, Z) → U2_GAA(X, Y, Z, le_in_gaa(X, Y, B))
MINUS_IN_GAA(X, Y, Z) → LE_IN_GAA(X, Y, B)
LE_IN_GAA(s(X), s(Y), B) → U1_GAA(X, Y, B, le_in_gaa(X, Y, B))
LE_IN_GAA(s(X), s(Y), B) → LE_IN_GAA(X, Y, B)
U2_GAA(X, Y, Z, le_out_gaa(X, Y, B)) → U3_GAA(X, Y, Z, if_in_ggaa(B, X, Y, Z))
U2_GAA(X, Y, Z, le_out_gaa(X, Y, B)) → IF_IN_GGAA(B, X, Y, Z)
IF_IN_GGAA(false, X, Y, s(Z)) → U4_GGAA(X, Y, Z, p_in_ga(X, X1))
IF_IN_GGAA(false, X, Y, s(Z)) → P_IN_GA(X, X1)
U4_GGAA(X, Y, Z, p_out_ga(X, X1)) → U5_GGAA(X, Y, Z, minus_in_gaa(X1, Y, Z))
U4_GGAA(X, Y, Z, p_out_ga(X, X1)) → MINUS_IN_GAA(X1, Y, Z)

The TRS R consists of the following rules:

minus_in_gaa(X, Y, Z) → U2_gaa(X, Y, Z, le_in_gaa(X, Y, B))
le_in_gaa(0, Y, true) → le_out_gaa(0, Y, true)
le_in_gaa(s(X), 0, false) → le_out_gaa(s(X), 0, false)
le_in_gaa(s(X), s(Y), B) → U1_gaa(X, Y, B, le_in_gaa(X, Y, B))
U1_gaa(X, Y, B, le_out_gaa(X, Y, B)) → le_out_gaa(s(X), s(Y), B)
U2_gaa(X, Y, Z, le_out_gaa(X, Y, B)) → U3_gaa(X, Y, Z, if_in_ggaa(B, X, Y, Z))
if_in_ggaa(true, X, Y, 0) → if_out_ggaa(true, X, Y, 0)
if_in_ggaa(false, X, Y, s(Z)) → U4_ggaa(X, Y, Z, p_in_ga(X, X1))
p_in_ga(0, 0) → p_out_ga(0, 0)
p_in_ga(s(X), X) → p_out_ga(s(X), X)
U4_ggaa(X, Y, Z, p_out_ga(X, X1)) → U5_ggaa(X, Y, Z, minus_in_gaa(X1, Y, Z))
U5_ggaa(X, Y, Z, minus_out_gaa(X1, Y, Z)) → if_out_ggaa(false, X, Y, s(Z))
U3_gaa(X, Y, Z, if_out_ggaa(B, X, Y, Z)) → minus_out_gaa(X, Y, Z)

The argument filtering Pi contains the following mapping:
minus_in_gaa(x1, x2, x3)  =  minus_in_gaa(x1)
U2_gaa(x1, x2, x3, x4)  =  U2_gaa(x1, x4)
le_in_gaa(x1, x2, x3)  =  le_in_gaa(x1)
0  =  0
le_out_gaa(x1, x2, x3)  =  le_out_gaa(x3)
s(x1)  =  s(x1)
U1_gaa(x1, x2, x3, x4)  =  U1_gaa(x4)
U3_gaa(x1, x2, x3, x4)  =  U3_gaa(x4)
if_in_ggaa(x1, x2, x3, x4)  =  if_in_ggaa(x1, x2)
true  =  true
if_out_ggaa(x1, x2, x3, x4)  =  if_out_ggaa(x4)
false  =  false
U4_ggaa(x1, x2, x3, x4)  =  U4_ggaa(x4)
p_in_ga(x1, x2)  =  p_in_ga(x1)
p_out_ga(x1, x2)  =  p_out_ga(x2)
U5_ggaa(x1, x2, x3, x4)  =  U5_ggaa(x4)
minus_out_gaa(x1, x2, x3)  =  minus_out_gaa(x3)
P_IN_GA(x1, x2)  =  P_IN_GA(x1)
LE_IN_GAA(x1, x2, x3)  =  LE_IN_GAA(x1)
U3_GAA(x1, x2, x3, x4)  =  U3_GAA(x4)
MINUS_IN_GAA(x1, x2, x3)  =  MINUS_IN_GAA(x1)
U4_GGAA(x1, x2, x3, x4)  =  U4_GGAA(x4)
IF_IN_GGAA(x1, x2, x3, x4)  =  IF_IN_GGAA(x1, x2)
U5_GGAA(x1, x2, x3, x4)  =  U5_GGAA(x4)
U1_GAA(x1, x2, x3, x4)  =  U1_GAA(x4)
U2_GAA(x1, x2, x3, x4)  =  U2_GAA(x1, x4)

We have to consider all (P,R,Pi)-chains

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
PiDP
          ↳ DependencyGraphProof

Pi DP problem:
The TRS P consists of the following rules:

MINUS_IN_GAA(X, Y, Z) → U2_GAA(X, Y, Z, le_in_gaa(X, Y, B))
MINUS_IN_GAA(X, Y, Z) → LE_IN_GAA(X, Y, B)
LE_IN_GAA(s(X), s(Y), B) → U1_GAA(X, Y, B, le_in_gaa(X, Y, B))
LE_IN_GAA(s(X), s(Y), B) → LE_IN_GAA(X, Y, B)
U2_GAA(X, Y, Z, le_out_gaa(X, Y, B)) → U3_GAA(X, Y, Z, if_in_ggaa(B, X, Y, Z))
U2_GAA(X, Y, Z, le_out_gaa(X, Y, B)) → IF_IN_GGAA(B, X, Y, Z)
IF_IN_GGAA(false, X, Y, s(Z)) → U4_GGAA(X, Y, Z, p_in_ga(X, X1))
IF_IN_GGAA(false, X, Y, s(Z)) → P_IN_GA(X, X1)
U4_GGAA(X, Y, Z, p_out_ga(X, X1)) → U5_GGAA(X, Y, Z, minus_in_gaa(X1, Y, Z))
U4_GGAA(X, Y, Z, p_out_ga(X, X1)) → MINUS_IN_GAA(X1, Y, Z)

The TRS R consists of the following rules:

minus_in_gaa(X, Y, Z) → U2_gaa(X, Y, Z, le_in_gaa(X, Y, B))
le_in_gaa(0, Y, true) → le_out_gaa(0, Y, true)
le_in_gaa(s(X), 0, false) → le_out_gaa(s(X), 0, false)
le_in_gaa(s(X), s(Y), B) → U1_gaa(X, Y, B, le_in_gaa(X, Y, B))
U1_gaa(X, Y, B, le_out_gaa(X, Y, B)) → le_out_gaa(s(X), s(Y), B)
U2_gaa(X, Y, Z, le_out_gaa(X, Y, B)) → U3_gaa(X, Y, Z, if_in_ggaa(B, X, Y, Z))
if_in_ggaa(true, X, Y, 0) → if_out_ggaa(true, X, Y, 0)
if_in_ggaa(false, X, Y, s(Z)) → U4_ggaa(X, Y, Z, p_in_ga(X, X1))
p_in_ga(0, 0) → p_out_ga(0, 0)
p_in_ga(s(X), X) → p_out_ga(s(X), X)
U4_ggaa(X, Y, Z, p_out_ga(X, X1)) → U5_ggaa(X, Y, Z, minus_in_gaa(X1, Y, Z))
U5_ggaa(X, Y, Z, minus_out_gaa(X1, Y, Z)) → if_out_ggaa(false, X, Y, s(Z))
U3_gaa(X, Y, Z, if_out_ggaa(B, X, Y, Z)) → minus_out_gaa(X, Y, Z)

The argument filtering Pi contains the following mapping:
minus_in_gaa(x1, x2, x3)  =  minus_in_gaa(x1)
U2_gaa(x1, x2, x3, x4)  =  U2_gaa(x1, x4)
le_in_gaa(x1, x2, x3)  =  le_in_gaa(x1)
0  =  0
le_out_gaa(x1, x2, x3)  =  le_out_gaa(x3)
s(x1)  =  s(x1)
U1_gaa(x1, x2, x3, x4)  =  U1_gaa(x4)
U3_gaa(x1, x2, x3, x4)  =  U3_gaa(x4)
if_in_ggaa(x1, x2, x3, x4)  =  if_in_ggaa(x1, x2)
true  =  true
if_out_ggaa(x1, x2, x3, x4)  =  if_out_ggaa(x4)
false  =  false
U4_ggaa(x1, x2, x3, x4)  =  U4_ggaa(x4)
p_in_ga(x1, x2)  =  p_in_ga(x1)
p_out_ga(x1, x2)  =  p_out_ga(x2)
U5_ggaa(x1, x2, x3, x4)  =  U5_ggaa(x4)
minus_out_gaa(x1, x2, x3)  =  minus_out_gaa(x3)
P_IN_GA(x1, x2)  =  P_IN_GA(x1)
LE_IN_GAA(x1, x2, x3)  =  LE_IN_GAA(x1)
U3_GAA(x1, x2, x3, x4)  =  U3_GAA(x4)
MINUS_IN_GAA(x1, x2, x3)  =  MINUS_IN_GAA(x1)
U4_GGAA(x1, x2, x3, x4)  =  U4_GGAA(x4)
IF_IN_GGAA(x1, x2, x3, x4)  =  IF_IN_GGAA(x1, x2)
U5_GGAA(x1, x2, x3, x4)  =  U5_GGAA(x4)
U1_GAA(x1, x2, x3, x4)  =  U1_GAA(x4)
U2_GAA(x1, x2, x3, x4)  =  U2_GAA(x1, x4)

We have to consider all (P,R,Pi)-chains
The approximation of the Dependency Graph [30] contains 2 SCCs with 5 less nodes.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
PiDP
                ↳ UsableRulesProof
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

LE_IN_GAA(s(X), s(Y), B) → LE_IN_GAA(X, Y, B)

The TRS R consists of the following rules:

minus_in_gaa(X, Y, Z) → U2_gaa(X, Y, Z, le_in_gaa(X, Y, B))
le_in_gaa(0, Y, true) → le_out_gaa(0, Y, true)
le_in_gaa(s(X), 0, false) → le_out_gaa(s(X), 0, false)
le_in_gaa(s(X), s(Y), B) → U1_gaa(X, Y, B, le_in_gaa(X, Y, B))
U1_gaa(X, Y, B, le_out_gaa(X, Y, B)) → le_out_gaa(s(X), s(Y), B)
U2_gaa(X, Y, Z, le_out_gaa(X, Y, B)) → U3_gaa(X, Y, Z, if_in_ggaa(B, X, Y, Z))
if_in_ggaa(true, X, Y, 0) → if_out_ggaa(true, X, Y, 0)
if_in_ggaa(false, X, Y, s(Z)) → U4_ggaa(X, Y, Z, p_in_ga(X, X1))
p_in_ga(0, 0) → p_out_ga(0, 0)
p_in_ga(s(X), X) → p_out_ga(s(X), X)
U4_ggaa(X, Y, Z, p_out_ga(X, X1)) → U5_ggaa(X, Y, Z, minus_in_gaa(X1, Y, Z))
U5_ggaa(X, Y, Z, minus_out_gaa(X1, Y, Z)) → if_out_ggaa(false, X, Y, s(Z))
U3_gaa(X, Y, Z, if_out_ggaa(B, X, Y, Z)) → minus_out_gaa(X, Y, Z)

The argument filtering Pi contains the following mapping:
minus_in_gaa(x1, x2, x3)  =  minus_in_gaa(x1)
U2_gaa(x1, x2, x3, x4)  =  U2_gaa(x1, x4)
le_in_gaa(x1, x2, x3)  =  le_in_gaa(x1)
0  =  0
le_out_gaa(x1, x2, x3)  =  le_out_gaa(x3)
s(x1)  =  s(x1)
U1_gaa(x1, x2, x3, x4)  =  U1_gaa(x4)
U3_gaa(x1, x2, x3, x4)  =  U3_gaa(x4)
if_in_ggaa(x1, x2, x3, x4)  =  if_in_ggaa(x1, x2)
true  =  true
if_out_ggaa(x1, x2, x3, x4)  =  if_out_ggaa(x4)
false  =  false
U4_ggaa(x1, x2, x3, x4)  =  U4_ggaa(x4)
p_in_ga(x1, x2)  =  p_in_ga(x1)
p_out_ga(x1, x2)  =  p_out_ga(x2)
U5_ggaa(x1, x2, x3, x4)  =  U5_ggaa(x4)
minus_out_gaa(x1, x2, x3)  =  minus_out_gaa(x3)
LE_IN_GAA(x1, x2, x3)  =  LE_IN_GAA(x1)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

LE_IN_GAA(s(X), s(Y), B) → LE_IN_GAA(X, Y, B)

R is empty.
The argument filtering Pi contains the following mapping:
s(x1)  =  s(x1)
LE_IN_GAA(x1, x2, x3)  =  LE_IN_GAA(x1)

We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ QDPSizeChangeProof
              ↳ PiDP

Q DP problem:
The TRS P consists of the following rules:

LE_IN_GAA(s(X)) → LE_IN_GAA(X)

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.
By using the subterm criterion [20] together with the size-change analysis [32] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
PiDP
                ↳ UsableRulesProof

Pi DP problem:
The TRS P consists of the following rules:

U2_GAA(X, Y, Z, le_out_gaa(X, Y, B)) → IF_IN_GGAA(B, X, Y, Z)
MINUS_IN_GAA(X, Y, Z) → U2_GAA(X, Y, Z, le_in_gaa(X, Y, B))
U4_GGAA(X, Y, Z, p_out_ga(X, X1)) → MINUS_IN_GAA(X1, Y, Z)
IF_IN_GGAA(false, X, Y, s(Z)) → U4_GGAA(X, Y, Z, p_in_ga(X, X1))

The TRS R consists of the following rules:

minus_in_gaa(X, Y, Z) → U2_gaa(X, Y, Z, le_in_gaa(X, Y, B))
le_in_gaa(0, Y, true) → le_out_gaa(0, Y, true)
le_in_gaa(s(X), 0, false) → le_out_gaa(s(X), 0, false)
le_in_gaa(s(X), s(Y), B) → U1_gaa(X, Y, B, le_in_gaa(X, Y, B))
U1_gaa(X, Y, B, le_out_gaa(X, Y, B)) → le_out_gaa(s(X), s(Y), B)
U2_gaa(X, Y, Z, le_out_gaa(X, Y, B)) → U3_gaa(X, Y, Z, if_in_ggaa(B, X, Y, Z))
if_in_ggaa(true, X, Y, 0) → if_out_ggaa(true, X, Y, 0)
if_in_ggaa(false, X, Y, s(Z)) → U4_ggaa(X, Y, Z, p_in_ga(X, X1))
p_in_ga(0, 0) → p_out_ga(0, 0)
p_in_ga(s(X), X) → p_out_ga(s(X), X)
U4_ggaa(X, Y, Z, p_out_ga(X, X1)) → U5_ggaa(X, Y, Z, minus_in_gaa(X1, Y, Z))
U5_ggaa(X, Y, Z, minus_out_gaa(X1, Y, Z)) → if_out_ggaa(false, X, Y, s(Z))
U3_gaa(X, Y, Z, if_out_ggaa(B, X, Y, Z)) → minus_out_gaa(X, Y, Z)

The argument filtering Pi contains the following mapping:
minus_in_gaa(x1, x2, x3)  =  minus_in_gaa(x1)
U2_gaa(x1, x2, x3, x4)  =  U2_gaa(x1, x4)
le_in_gaa(x1, x2, x3)  =  le_in_gaa(x1)
0  =  0
le_out_gaa(x1, x2, x3)  =  le_out_gaa(x3)
s(x1)  =  s(x1)
U1_gaa(x1, x2, x3, x4)  =  U1_gaa(x4)
U3_gaa(x1, x2, x3, x4)  =  U3_gaa(x4)
if_in_ggaa(x1, x2, x3, x4)  =  if_in_ggaa(x1, x2)
true  =  true
if_out_ggaa(x1, x2, x3, x4)  =  if_out_ggaa(x4)
false  =  false
U4_ggaa(x1, x2, x3, x4)  =  U4_ggaa(x4)
p_in_ga(x1, x2)  =  p_in_ga(x1)
p_out_ga(x1, x2)  =  p_out_ga(x2)
U5_ggaa(x1, x2, x3, x4)  =  U5_ggaa(x4)
minus_out_gaa(x1, x2, x3)  =  minus_out_gaa(x3)
MINUS_IN_GAA(x1, x2, x3)  =  MINUS_IN_GAA(x1)
U4_GGAA(x1, x2, x3, x4)  =  U4_GGAA(x4)
IF_IN_GGAA(x1, x2, x3, x4)  =  IF_IN_GGAA(x1, x2)
U2_GAA(x1, x2, x3, x4)  =  U2_GAA(x1, x4)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof

Pi DP problem:
The TRS P consists of the following rules:

U2_GAA(X, Y, Z, le_out_gaa(X, Y, B)) → IF_IN_GGAA(B, X, Y, Z)
MINUS_IN_GAA(X, Y, Z) → U2_GAA(X, Y, Z, le_in_gaa(X, Y, B))
U4_GGAA(X, Y, Z, p_out_ga(X, X1)) → MINUS_IN_GAA(X1, Y, Z)
IF_IN_GGAA(false, X, Y, s(Z)) → U4_GGAA(X, Y, Z, p_in_ga(X, X1))

The TRS R consists of the following rules:

le_in_gaa(0, Y, true) → le_out_gaa(0, Y, true)
le_in_gaa(s(X), 0, false) → le_out_gaa(s(X), 0, false)
le_in_gaa(s(X), s(Y), B) → U1_gaa(X, Y, B, le_in_gaa(X, Y, B))
p_in_ga(0, 0) → p_out_ga(0, 0)
p_in_ga(s(X), X) → p_out_ga(s(X), X)
U1_gaa(X, Y, B, le_out_gaa(X, Y, B)) → le_out_gaa(s(X), s(Y), B)

The argument filtering Pi contains the following mapping:
le_in_gaa(x1, x2, x3)  =  le_in_gaa(x1)
0  =  0
le_out_gaa(x1, x2, x3)  =  le_out_gaa(x3)
s(x1)  =  s(x1)
U1_gaa(x1, x2, x3, x4)  =  U1_gaa(x4)
true  =  true
false  =  false
p_in_ga(x1, x2)  =  p_in_ga(x1)
p_out_ga(x1, x2)  =  p_out_ga(x2)
MINUS_IN_GAA(x1, x2, x3)  =  MINUS_IN_GAA(x1)
U4_GGAA(x1, x2, x3, x4)  =  U4_GGAA(x4)
IF_IN_GGAA(x1, x2, x3, x4)  =  IF_IN_GGAA(x1, x2)
U2_GAA(x1, x2, x3, x4)  =  U2_GAA(x1, x4)

We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ UsableRulesReductionPairsProof

Q DP problem:
The TRS P consists of the following rules:

U4_GGAA(p_out_ga(X1)) → MINUS_IN_GAA(X1)
IF_IN_GGAA(false, X) → U4_GGAA(p_in_ga(X))
U2_GAA(X, le_out_gaa(B)) → IF_IN_GGAA(B, X)
MINUS_IN_GAA(X) → U2_GAA(X, le_in_gaa(X))

The TRS R consists of the following rules:

le_in_gaa(0) → le_out_gaa(true)
le_in_gaa(s(X)) → le_out_gaa(false)
le_in_gaa(s(X)) → U1_gaa(le_in_gaa(X))
p_in_ga(0) → p_out_ga(0)
p_in_ga(s(X)) → p_out_ga(X)
U1_gaa(le_out_gaa(B)) → le_out_gaa(B)

The set Q consists of the following terms:

le_in_gaa(x0)
p_in_ga(x0)
U1_gaa(x0)

We have to consider all (P,Q,R)-chains.
By using the usable rules with reduction pair processor [15] with a polynomial ordering [25], all dependency pairs and the corresponding usable rules [17] can be oriented non-strictly. All non-usable rules are removed, and those dependency pairs and usable rules that have been oriented strictly or contain non-usable symbols in their left-hand side are removed as well.

The following dependency pairs can be deleted:

U4_GGAA(p_out_ga(X1)) → MINUS_IN_GAA(X1)
The following rules are removed from R:

le_in_gaa(s(X)) → le_out_gaa(false)
le_in_gaa(s(X)) → U1_gaa(le_in_gaa(X))
U1_gaa(le_out_gaa(B)) → le_out_gaa(B)
p_in_ga(s(X)) → p_out_ga(X)
Used ordering: POLO with Polynomial interpretation [25]:

POL(0) = 0   
POL(IF_IN_GGAA(x1, x2)) = x1 + x2   
POL(MINUS_IN_GAA(x1)) = 2·x1   
POL(U1_gaa(x1)) = 2 + x1   
POL(U2_GAA(x1, x2)) = x1 + x2   
POL(U4_GGAA(x1)) = x1   
POL(false) = 1   
POL(le_in_gaa(x1)) = x1   
POL(le_out_gaa(x1)) = 2·x1   
POL(p_in_ga(x1)) = 1 + x1   
POL(p_out_ga(x1)) = 1 + 2·x1   
POL(s(x1)) = 2 + 2·x1   
POL(true) = 0   



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
                      ↳ QDP
                        ↳ UsableRulesReductionPairsProof
QDP
                            ↳ DependencyGraphProof

Q DP problem:
The TRS P consists of the following rules:

IF_IN_GGAA(false, X) → U4_GGAA(p_in_ga(X))
U2_GAA(X, le_out_gaa(B)) → IF_IN_GGAA(B, X)
MINUS_IN_GAA(X) → U2_GAA(X, le_in_gaa(X))

The TRS R consists of the following rules:

le_in_gaa(0) → le_out_gaa(true)
p_in_ga(0) → p_out_ga(0)

The set Q consists of the following terms:

le_in_gaa(x0)
p_in_ga(x0)
U1_gaa(x0)

We have to consider all (P,Q,R)-chains.
The approximation of the Dependency Graph [15,17,22] contains 0 SCCs with 3 less nodes.